// 
// $Rev:: 6             $:  Revision of last commit
// $Author:: rvhaverm@g#$:  Author of last commit
// $Date:: 2010-07-25 1#$:  Date of last commit
// 
package agents.messages;

import com.ibm.aglet.Message;

import agents.agents.Receptionist;
import agents.configuration.IHostConfiguration;
import agents.interfaces.IAgent;


/**
 * Set the host's properties.
 * 
 * This message is sent to the Receptionist right after it has been created by
 * the ServiceApp. It makes sure that every agent that want to have read access
 * to the properties of the system it lives in, can ask the receptionist for
 * them.
 * 
 * @author Ruben Van Havermaet
 * @version $Rev::$
 * @see agents.agents.Receptionist#setSystemProperties(Message)
 */
public class SetSystemPropertiesMessage extends BaseMessage
{
    private IHostConfiguration _configuration = null;

    public SetSystemPropertiesMessage()
    {	
    }
    
    public void setMessage(Message msg)
    {
	super.setMessage(msg);
	
	_configuration = (IHostConfiguration) getMessage().getArg("configuration");
    }
    
    /**
     * @param props
     *            the properties of the host
     */
    public SetSystemPropertiesMessage(IHostConfiguration config)
    {
	_configuration = config;
	getMessage().setArg("configuration", _configuration);
    }

   
    @Override
    public void sentTo(Receptionist agent)
    {
	agent.setSystemProperties(_configuration);
	
	
    }
}
